﻿using CQRSFramework.Common.Components;
using CQRSFramework.Common.Configurations;
using CQRSFramework.Events;

namespace CQRSFramework.MySql
{
    public static class ConfigurationExtensions
    {
        public static CommonConfiguration UseMySQLEventStore(this CommonConfiguration configuration)
        {
            ObjectContainer.Register<IEventStore, MySQLEventStore>();
            return configuration;
        }
        public static CommonConfiguration InitMySQLEventStore(this CommonConfiguration configuration, string connectionString)
        {
            var mysqlEventStore = (MySQLEventStore)ObjectContainer.Resolve<IEventStore>();
            mysqlEventStore.InitEventStore(connectionString);
            return configuration;
        }
    }
}
